from django.db import models

# Needed from NoPBX
from nopbx.core.models import BaseModule


###############################################################################

class Config(BaseModule):
    """
    Asterisk Realtime-Static configuration
    """
    cat_metric = models.IntegerField(default = '0', editable = False)
    var_metric = models.IntegerField(default = '0')
    commented  = models.BooleanField(default = False)
    filename   = models.CharField(max_length = 128)
    category   = models.CharField(max_length = 128)
    var_name   = models.CharField(max_length = 128, verbose_name = 'variable')
    var_val    = models.CharField(max_length = 128, verbose_name = 'value')

    class Meta:
        ordering = ['filename', 'cat_metric', 'var_metric']

    def __unicode__(self):
        return '%s -> [%s] %s' % (self.filename, self.category, self.var_name)


###############################################################################

